/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package assignment2.stub;

import assignment2.data.OrderDetails;
import assignment2.data.OrderDetailsFacade;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

/**
 *
 * @author tuan
 */
public class OrderDetailsTbl_Stub {

    OrderDetailsFacade orderDetailsFacade = lookupOrderDetailsFacadeBean();

    public void insert(OrderDetails orderdetail) {
        orderDetailsFacade.create(orderdetail);
        
    }
    
    public OrderDetails findByOrderID(int orderID){
        return orderDetailsFacade.find(orderID);
    }

    private OrderDetailsFacade lookupOrderDetailsFacadeBean() {
        try {
            Context c = new InitialContext();
            return (OrderDetailsFacade) c.lookup("java:global/Assignment2/Assignment2-ejb/OrderDetailsFacade!assignment2.data.OrderDetailsFacade");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }
}
